package com.xiangdao.controller;

import com.xiangdao.dao.UserDao;
import com.xiangdao.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import javax.servlet.http.HttpSession;
@Controller
public class pCenterController {
    @Autowired
    UserDao userDao;
    @RequestMapping(path = "/pCenter/{name}",method = RequestMethod.GET)
    public String displayPcenter(HttpSession session, Model model,@PathVariable String name) {
        User userById = userDao.getUserByUsername(name);
        model.addAttribute("u",userById);
        return "/my_message";
    }
}
